package study04;

import java.util.ArrayList;
import java.util.Comparator;

public class Java06_sort {
    public static void main(String[] args) {
        ArrayList<Integer> list = new ArrayList();
        list.add(1);
        list.add(4);
        list.add(2);
        list.add(3);

        list.sort(new NumSort());
        System.out.println(list);
    }
}

class NumSort implements Comparator<Integer> {
    @Override
    public int compare(Integer o1, Integer o2) {
        return o1 - o2;
    }
}
